package whf.framework.log.entity;

import java.sql.Timestamp;

import whf.framework.entity.AbstractEntity;
import whf.framework.security.UserContext;
import whf.framework.util.ThreadContext;

/**
 * 日志对象
 * 
 * @author wanghaifeng
 * @create Oct 29, 2006 8:16:58 AM
 * 
 */
public class Log extends AbstractEntity implements Logable {
	public static String LOG_TYPE_ACCESS = "access";
	
	private UserContext userContext;
	private String department;
	private String operator;
	private String operationType;
	private String operation;
	private Timestamp operateTime;
	private String target;
	private String params;
	private String sessionId;
	private String ip;
	private long consumeTime;

	public Log() {
		this.operationType = "access";
	}
	
	public Log(String department, String operator, 
			String target, String operationType, String operation, String params, 
			String sessionId, String ip, long consumeTime,String remarks) {
		this.userContext = ThreadContext.getUserContext();
		this.operator = operator;
		this.operationType = operationType;
		this.operation = operation;
		this.params = params;
		this.target = target;
		this.sessionId = sessionId;
		this.ip = ip;
		this.consumeTime = consumeTime;
		this.operateTime = new Timestamp(System.currentTimeMillis());
		super.setRemarks(remarks);
	}
	
	public UserContext getUserContext() {
		return this.userContext;
	}
	
	public String getOperator() {
		return operator;
	}

	public void setOperator(String operator) {
		this.operator = operator;
	}

	public String getOperationType() {
		return operationType;
	}

	public void setOperationType(String operationType) {
		this.operationType = operationType;
	}

	public String getOperation() {
		return operation;
	}

	public void setOperation(String operation) {
		this.operation = operation;
	}

	public String getTarget() {
		return target;
	}

	public void setTarget(String target) {
		this.target = target;
	}

	public String getSessionId() {
		return sessionId;
	}

	public void setSessionId(String sessionId) {
		this.sessionId = sessionId;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public long getConsumeTime() {
		return consumeTime;
	}

	public void setConsumeTime(long consumeTime) {
		this.consumeTime = consumeTime;
	}

	public String getParams() {
		return params;
	}

	public void setParams(String params) {
		this.params = params;
	}

	public String getDepartment() {
		return department;
	}

	public void setDepartment(String department) {
		this.department = department;
	}

	public Timestamp getOperateTime() {
		return operateTime;
	}

	public void setOperateTime(Timestamp operateTime) {
		this.operateTime = operateTime;
	}

}
